<template>
  <div>{{ info.name }}</div>
  <button @click="changeName">姓名-变化了：{{ info.name }}</button>
  <div>{{ info.age }}</div>
  <button @click="changeCout">年龄-变化了：{{ info.age }}</button>
</template>

<script setup>
import { ref, watch } from "vue";
const info = ref({ name: "莉莉", age: 18 });
const changeName = () => {
  info.value.name = "李莉莉-么么哒";
};

const changeCout = () => {
  info.value.age++;
};
// watch 监听多个数据源
watch(info, () => {});
</script>

<style>
#app {
  width: 100vw;
  height: 100vh;
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
</style>
